package vip.finance.makemoney.controller;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import vip.finance.makemoney.common.WebJson;
import vip.finance.makemoney.common.vo.ScheduleVo;
import vip.finance.makemoney.service.ScheduleService;

import java.util.List;

/**
 * 调度
 *
 * @author 杨滨
 * @date 2023年02月21日
 */
@RestController
@RequestMapping("/schedule")
public class ScheduleController extends BaseController {

    @Resource
    private ScheduleService scheduleService;

    //调度列表
    @GetMapping("/schedule-list")
    public WebJson<List<ScheduleVo>> scheduleList() {
        return WebJson.success(scheduleService.scheduleList());
    }

    //运行调度
    @PostMapping("/run-schedule")
    public WebJson<Object> runSchedule(@RequestParam Integer scheduleId, @RequestParam String args) {
        scheduleService.runSchedule(scheduleId, args);
        return WebJson.success();
    }
}
